// Fill out your copyright notice in the Description page of Project Settings.

#include "Isalong2.h"
#include "CanTeenCustomLogic.h"




UCanTeenCustomLogic::UCanTeenCustomLogic()
{
	_override_OnFireBegin = true;
	_override_OnFireAnimationEnd = true;
	_override_OnFireEnd = true;
	_override_OnFireAnimationFired = true;
}

void UCanTeenCustomLogic::OnFireBegin()
{
	// do montage anim here
	_compOwner->GetWeaponOwner()->OnPlayMontage(_compOwner->GetRightData()->_characterFireMontage);
	UGameplayStatics::GetPlayerCameraManager(_compOwner, 0)->PlayCameraShake(_compOwner->GetWeaponPackData()._fireShake);
}

void UCanTeenCustomLogic::OnFireEnd()
{

}

void UCanTeenCustomLogic::OnFireAnimationFired()
{
	// set contains //
	auto ammount = _takeAmmounts > _compOwner->GetBulletContains() ? _compOwner->GetBulletContains() : _takeAmmounts;
	_compOwner->SetBulletContains(_compOwner->GetBulletContains() - ammount, true);
	_compOwner->GetWeaponOwner()->OnBulletChangeCallBack();
	int water= GlobalData::Init()->Str_Get<int>(PLAYER_WATER);
	water = water + ammount > 100 ? 100 : water + ammount;
	GlobalData::Init()->Str_Set<int>(PLAYER_WATER, water);
}

void UCanTeenCustomLogic::OnFireAnimationEnd()
{

}
